]<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>角色管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use(['laypage', 'form', 'table'], function(){
				form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
				form.render();
				var table = layui.table;
				table.init('roleTable',{limit:30});
			}); 
		});
	</script>
</head>
<body>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
		<li class="layui-this"><a href="${ctx}/sys/role/">角色列表</a></li>
		<shiro:hasPermission name="sys:role:edit"><li><a href="${ctx}/sys/role/form">角色添加</a></li></shiro:hasPermission>
	</ul></div>
	<sys:message content="${message}"/>
	<table id="contentTable" class="layui-table" lay-filter="roleTable">
		<thead>
		<tr>
			<th lay-data="{field:'name', minWidth:120}">角色名称</th>
			<th lay-data="{field:'engName', minWidth:80}">英文名称</th>
			<th lay-data="{field:'office', minWidth:100}">归属机构</th>
			<th lay-data="{field:'dataScope', minWidth:200}">数据范围</th>
			<shiro:hasPermission name="sys:role:edit">
			<th lay-data="{field:'delFlag', minWidth:170}">操作</th>
			</shiro:hasPermission></tr>
		</thead>
		<c:forEach items="${list}" var="role">
			<tr>
				<td><a class="layui-blue" href="form?id=${role.id}">${role.name}</a></td>
				<td><a class="layui-blue" href="form?id=${role.id}">${role.enname}</a></td>
				<td>${role.office.name}</td>
				<td>${fns:getDictLabel(role.dataScope, 'sys_data_scope', '无')}</td>
				<shiro:hasPermission name="sys:role:edit"><td>
					<a class="layui-btn layui-btn-normal layui-btn-xs"
					 href="${ctx}/sys/role/assign?id=${role.id}">分配</a>
					<c:if test="${(role.sysData eq fns:getDictValue('是', 'yes_no', '1') && fns:getUser().admin)||!(role.sysData eq fns:getDictValue('是', 'yes_no', '1'))}">
						<a class="layui-btn layui-btn-xs" lay-event="edit"
						 href="${ctx}/sys/role/form?id=${role.id}">修改</a>
					</c:if>
					<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"
					 href="${ctx}/sys/role/delete?id=${role.id}" onclick="return confirmx('确认要删除该角色吗？', this.href)">删除</a>
				</td></shiro:hasPermission>	
			</tr>
		</c:forEach>
	</table>
</body>
</html>